package cn.ixinjiu.libraryMangement;

import cn.ixinjiu.libraryMangement.utils.JDBCUtil;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by XinChen on 2023-05-07
 *
 * @TODO 测试
 */
public class Test {
    public static void main(String[] args) throws SQLException {
//        BookInfo bookInfo = new BookInfo();
//        bookInfo.setBookName("aa");
//        String bookName = bookInfo.getBookName();
//        System.out.println("bookName = " + bookName);

        // 测试数据库连接
        Connection connection = JDBCUtil.getConnection();
        System.out.println("connection = " + connection);

        // 测试返回数据
        ResultSet query = JDBCUtil.query("SELECT COUNT(*) as count FROM `borrow_info`", null);
        int count = 0;
        while  (query.next()) {
            count = query.getInt("count");
        }
        System.out.println("count = " + count);
    }
}
